package util;

import java.io.BufferedWriter;
import java.io.IOException;

public class Statistics {

	public double elapsedTime = 0; // second
	public double loadDataTime = 0;
	public double optimalScore = 0;
	public double delta;
	public double maxRouteScore;
	public double minRouteScore;
	public int minNumFacility;
	public int maxNumFacility;
	public int numRoutes;
	public double avgRouteScore;
	public int numFacilities;
	public double avgNumFacility;
	public int avgRouteNodes;
	public int totalNumSegs = 0;
	public int numSplits = 0;
	public int prune1 = 0;
	public int prune2 = 0;

	public void toFile(BufferedWriter bw) throws Exception {

		bw.write("elapsed time: " + elapsedTime);
		bw.newLine();

		bw.write("load data time: " + loadDataTime);
		bw.newLine();

		bw.write("optimal score: " + optimalScore);
		bw.newLine();

		// stats about the data

		bw.write("total num routes: " + numRoutes);
		bw.newLine();
		bw.write("max. route score: " + maxRouteScore);
		bw.newLine();
		bw.write("min route score: " + minRouteScore);
		bw.newLine();
		bw.write("avg route score: " + avgRouteScore);
		bw.newLine();

		bw.write("total num facilities: " + numFacilities);
		bw.newLine();
		bw.write("max num attracting facilities: " + maxNumFacility);
		bw.newLine();
		bw.write("min num attracting facilities: " + minNumFacility);
		bw.newLine();
		bw.write("avg num attracting facilities: " + avgNumFacility);
		bw.newLine();

		bw.write("avg num route nodes: " + avgRouteNodes);
		bw.newLine();

		bw.write("total num segs: " + totalNumSegs);
		bw.newLine();

		bw.write("total split: " + numSplits);
		bw.newLine();
			
		bw.write("prune1: " + prune1);
		bw.newLine();

		bw.write("prune2: " + prune2);
		bw.newLine();
	}
}
